
# The American Viewer: Political Consequences of Entertainment Media
# Eunji Kim and Shawn Patterson Jr 
# American Political Science Review 
# Replication File [Appendix H Table H2]



appendix_tableh2 <- read.csv("appendix_tableh2_censored.csv")


teaparty <- felm(attend09~  RTG_8PM_Nov_May + mccainshare08_new + 
                   log(population_04+1) +
                   log(medianHHI_04+1) + femaleP_04 + age65P_04 + whiteP_04 + blackP_04   +
                   collegeP_04 + foreignBP_04 + unemR_04 + 
                   log(avg_outflow_movers + 1) + log(avg_inflow_movers + 1)  + pop_density.x | 
                   STATE  | 0 | 0 , data = appendix_tableh2,  weights=appendix_tableh2$sum_CNTYTVHH) 



trade <- felm(county_lntotaffected_app ~  RTG_8PM_Nov_May + romneyshare12_new + 
                log(population_04+1) +
                log(medianHHI_04+1) + femaleP_04 + age65P_04 + whiteP_04 + blackP_04   +
                collegeP_04 + foreignBP_04 + unemR_04 + 
                log(avg_outflow_movers + 1) + log(avg_inflow_movers + 1)  + pop_density.x  | 
                STATE  | 0 | 0 , data = appendix_tableh2, weights=appendix_tableh2$sum_CNTYTVHH) 


stargazer(teaparty, trade, 
    star.cutoffs = c(.05,.01,.001),
    title="Instrument is Not Correlated with Precursors of Trumpism",
    dep.var.caption = "",
    label = "tab2",
    dep.var.labels=c('Tea Party', '(ln) Number of affected workers by approved TAA'),
    omit.stat=c("adj.rsq","LL","ser","f"),
    no.space=TRUE,
    omit = 'STATE',
    star.char = c("*", "**", "***"), 
    notes = c("* p<0.05; ** p<0.01; *** p<0.001"), 
    notes.append = F,
    notes.align="l",
    digits=3,
    type = "text",
    align = TRUE)
